package com.cskaoyan.market.controller;

import com.cskaoyan.market.db.domain.MarketTopic;
import com.cskaoyan.market.service.WxTopicService;
import com.cskaoyan.market.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author cx
 * @date 2023/4/3 0:46
 * @Version 1.0
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {
    @Autowired
    WxTopicService wxTopicService;

    @GetMapping("list")
    public Object list(Integer page, Integer limit){
        List<MarketTopic> result = wxTopicService.list(page, limit);
        return ResponseUtil.okList(result);
    }

    @GetMapping("detail")
    public Object detail(Integer id){
        Map<String, Object> result = wxTopicService.detail(id);
        return ResponseUtil.ok(result);
    }

    @GetMapping("related")
    public Object related(Integer id){
        List<MarketTopic> result = wxTopicService.related(id);
        return ResponseUtil.okList(result);
    }



}
